#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

void exit_handler()
{
    printf("exit handler\n");
}
void on_exitFun(int status, void *arg)
{
    printf("on exit \n");
    printf("exit status:%d\n", status);
    printf("args:%d\n", arg);
}
int main()
{
    if (0 != atexit(exit_handler))
    {
        perror("at exit\n");
        return 0;
    }
    if (0 != on_exit(on_exitFun, (void *)10))
    {
        perror("on exit\n");
        return 0;
    }
    printf("process start\n");
    printf("process exit\n");
    return 3;
}